<template>
  <div class="foodDetail-container">
    <div class="food-top">
      <!-- <img class="food-return" src="@/assets/img/icon_spxqy_back.png"> -->
      <img class="food-share" src="@/assets/img/icon_spxqy_fx.png" @click="Suk_share">
      <img class="food-img" :src="items.image">
    </div>
    <div class="food-bottom">
      <div class="detail-01">{{items.productName }}</div>
      <!-- <div class="detail-02">新品上架</div> -->
      <!-- <div class="detail-03">口味</div> -->
      <!-- <div class="detail-04">
        <div
          @click="onTaste"
          :index="index"
          v-for="(item, index) in taste"
          :key="index"
          :class="item.choose? 'detail-red':'detail-taste'"
        >{{item.name}}</div>
      </div>-->
      <div class="detail-05">
        <div class>
          <span class="money-true">￥{{items.price}}</span>
          <span class="money-error">￥{{items.price}}</span>
        </div>
        <!-- <div class="detail-addBtn">加入购物车</div> -->
      </div>
      <div class="detail-06">口味介绍</div>
      <div class="detail-07">{{ items.remark }}</div>
    </div>

    <!-- <div class="shop">
      <div class="shopbox">
        <img class="shopicon" src="@/assets/img/icon_spxqy_gwc.png" @click="showlist">
        <span class="info" v-if="hasfood == 0">{{ allfoodnum }}</span>
        <div class="moneybox">
          <span class="shopspan" v-if="hasfood == 0">共{{ allmoney }}元</span>
          <span class="shopspan">另需配送费{{ peisongmoney }}元</span>
        </div>

        <em class="shopem">{{ qisongmoney }}元起送</em>
        <div class="topay" v-if="hascheck == 0" @click="topay">
          <div>选好了</div>
        </div>
      </div>
    </div>-->
    <van-popup v-model="show" :overlay="false" position="bottom" class="topshoplist">
      <div class="topshoplist">
        <div class="shoplist" v-for="(list,index) in shoplist" :key="index">
          <img src="@/assets/img/img_msxp.png" class="shopfoodimg">
          <div style="display:inline-block;height:100%;margin-top:0.2rem;margin-left:0.2rem">
            <span>{{ list.name }}</span>
            <br>
            <span style="color:">￥{{ list.money }}</span>
          </div>
          <div class="infoodgurounp">
            <img src="@/assets/img/icon_ddgwc_jian.png" @click="miu(index)">
            <span>{{ list.foodnums }}</span>
            <img src="@/assets/img/icon_ddgwc_jia.png" @click="add(index)">
          </div>
        </div>
      </div>
      <div style="height:1.75rem"></div>
    </van-popup>
  </div>
</template>
<script>
export default {
  data() {
    return {
      // image:null, //这是我们的图片
      // productName:null,
      items: [],
      show: false,
      shoplist: [
      ]
      // taste: [
      //   {
      //     name: "微辣",
      //     choose: true
      //   },
      //   {
      //     name: "中辣",
      //     choose: false
      //   },
      //   {
      //     name: "变态辣",
      //     choose: false
      //   }
      // ]
    };
  },
  created() {
    console.log(this.$route.params.foodid);
    this.Suk_getlist();
  },
  methods: {
    // 下面的是分享
    Suk_share() {
      dsBridge.call("addFenXinag",'pgyer.com/eT6b');
    },
    Suk_getlist() {
      let that = this;
      that.$toast.loading({
        message: "加载中..."
      });
      let Sukdata = {
        proId: that.$route.params.foodid
      };
      console.log(Sukdata);
      that.axios
        .post(
          that.baseUrl + "/product/ProductOne",
          that.Qs.stringify(Sukdata),
          {
            headers: {
              "Content-Type": "application/x-www-form-urlencoded"
            }
          }
        )
        .then(function(res) {
          if (res.request.status === 200) {
            if (res.data.meta.code == 200) {
              console.log(res.data);

              that.items = res.data.data;
              console.log(that.items, 11111111);
              that.$toast.clear();
            } else if (res.data.meta.code == 501) {
            }
          }
        });
    },
    // 点击显示我们的弹出框
    showlist() {
      this.show = !this.show;
    },
    onTaste(e) {
      const that = this;
      let index = e.target.getAttribute("index");
      that.taste.map(item => {
        item.choose = false;
      });
      that.taste[index].choose = true;
      console.log(index);
    }
  }
};
</script>
<style lang="scss" scoped>
.money-true {
  color: #000;
  font-size: 0.6rem;
}
.topshoplist {
  background: #f4f4f4;
  width: 90%;
  margin: 0 auto;
  .shopfoodimg {
    width: 1.5rem;
    height: 1.5rem;
    margin: 0.1rem 0;
  }
  .shoplist {
    position: relative;
    margin-bottom: 0.1rem;
    border-bottom: 1px solid #ffffff;
  }
  .infoodgurounp {
    text-align: right;
    position: absolute;
    right: 0;
    top: 35%;
    img {
      width: 0.45rem;
      height: 0.45rem;
    }
  }
}
.shop {
  position: fixed;
  overflow: hidden;
  box-shadow: 0px 5px 5px 2px #d3b8b8;
  bottom: 1%;
  width: 90%;
  height: 8%;
  left: 5%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  font-size: 13px;
  border-radius: 50px;
  color: #fff;
  .info {
    display: inline-block;
    width: 15px;
    text-align: center;
    line-height: 15px;
    height: 15px;
    border-radius: 50%;
    background: red;
    position: absolute;
    top: 10%;
    left: 8%;
  }

  .shopbox {
    display: flex;
    height: 100%;
    align-items: center;
  }
  .shopicon {
    height: 50%;
    margin-left: 5%;
    vertical-align: middle;
  }
  .shopspan {
    margin-left: 5%;
  }
  .shopem {
    position: absolute;
    right: 10%;
  }
}
.money-error {
  text-decoration: line-through;
  color: #959595;
  font-size: 0.3rem;
}
.detail-addBtn {
  color: #fff;
  background: #ff2f4e;
  width: 2.2rem;
  height: 0.5rem;
  text-align: center;
  line-height: 0.5rem;
  border-radius: 0.25rem;
  color: 0.38rem;
}
.foodDetail-container {
  font-size: 0.3rem;
  width: 100%;
  margin: 0 auto;
}
.food-top {
  width: 100%;
  height: 8.1rem;
  position: relative;
}
.food-return {
  position: absolute;
  width: 1rem;
  height: 1rem;
  top: 0.3rem;
  left: 0.6rem;
}
.food-share {
  position: absolute;
  width: 1rem;
  height: 1rem;
  border-radius: 5px;
  top: 0.3rem;
  right: 0.6rem;
}
.food-img {
  height: 100%;
  width: 100%;
}
.food-bottom {
  display: flex;
  flex-direction: column;
  padding: 0 0.4rem;
}
.detail-01 {
  font-size: 0.48rem;
  line-height: 0.8rem;
}
.detail-02 {
  width: 1.6rem;
  height: 0.6rem;
  line-height: 0.6rem;
  color: #f4949b;
  border: 1px #f4949b solid;
  border-radius: 3px;
  text-align: center;
  font-size: 0.32rem;
}
.detail-03 {
  font-size: 0.3rem;
  color: #ccc;
  line-height: 0.76rem;
}
.detail-taste {
  color: #393838;
  background: #f5f1f2;
  width: 2.7rem;
  height: 0.7rem;
  line-height: 0.7rem;
  font-size: 0.4rem;
  text-align: center;
  border-radius: 0.35rem;
}
.detail-red {
  color: #fff;
  background: #ff2f4e;
  width: 2.7rem;
  height: 0.7rem;
  line-height: 0.7rem;
  font-size: 0.4rem;
  text-align: center;
  border-radius: 0.35rem;
}
.detail-04 {
  display: flex;
  justify-content: space-around;
}
.detail-05 {
  display: flex;
  justify-content: space-between;
  height: 1.8rem;
  align-items: center;
}
.detail-06 {
  height: 0.7rem;
  color: #000;
  font-size: 0.4rem;
}
.detail-07 {
  font-size: 0.3rem;
  line-height: 0.38rem;
  color: #aaa;
}
.foodlist {
  margin-top: 10px;
}

.foodbox {
  width: 70%;
  display: inline-block;
  position: absolute;
  max-height: 70%;
  .fooddesc {
    display: inline-block;
    width: 53%;
    height: 90px;
    vertical-align: middle;
  }
  .foodbox {
    overflow: hidden;
    width: 59%;
    height: 90px;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    .foodtit {
      font-size: 18px;
      font-weight: 500;
    }
    .foodcon {
      display: inline-block;
      font-style: normal;
      font-size: 10px;
      color: #a0a0a0;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      width: 100%;
    }
    .foodsoldnum {
      color: #a0a0a0;
    }
    .foodmoney {
      color: #ff3333;
      font-size: 18px;
    }
    .foodshop {
      position: absolute;
      right: 0;
      width: 65px;
      height: 20px;
      line-height: 20px;
      text-align: center;
      border-radius: 10px;
      display: inline-block;
      background: #ff9910;
      color: #fff;
      font-size: 12px;
    }
  }
}
.moneybox {
  display: flex;
  flex-direction: column;
  width: 40%;
}

.topay {
  display: inline-block;
  width: 40%;
  height: 100%;
  background: #ff2f4e;
  position: absolute;
  right: 0;
  text-align: center;
  div {
    font-size: 16px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 100%;
  }
}
</style>
